<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <title>查看会员信息</title>
    <link rel="stylesheet" type="text/css" href="/static/css/animate.min.css"/>
    <link rel="stylesheet" type="text/css" href="/static/css/index.css"/>
    <link rel="stylesheet" type="text/css" href="/static/css/mui.min.css"/>
    <link rel="stylesheet" type="text/css" href="/static/css/public.css"/>
    <script src="/static/js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="/static/js/jquery.cookie.js" type="text/javascript" charset="utf-8"></script>
    <script src="/static/js/mui.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="/static/js/index.js" type="text/javascript" charset="utf-8"></script>
    <script src="/static/layer/mobile/layer.js" type="text/javascript" charset="utf-8"></script>
</head>
<body style="background: #f5f5f5;">
	<div class="header">
		<a href="javascript:history.back(-1);" class="backPage"></a>
		<p class="page_title">查看会员信息</p>
	</div>
	<div style="width: 100%; height: 0.88rem; background: none;"></div>
	<div class="myInfoBox" style="height: 4.62rem;">
		<p>姓名 : {{ list.realname }}</p>
		<p>手机号 : {{ list.phone }}</p>
		<p>微信名 : {{ list.wx_name }}</p>
		<p>支付宝 : {{ list.zfb }}</p>
		<p>QQ : {{ list.qq }}</p>
        <p>等级 : {{ list.level }}级</p>
		<p>推荐人 : {{ list.sjname }}</p>
	</div>
	<div class="login_btn" style="margin-top:2.5rem">修改会员等级</div>
	<!-- <div class="login_btn">修改会员等级</div> -->
	<div class="mask"></div>
	<div class="jhmBox">
        <a href="javascript:void(0);" class="close"></a>
		<p class="maskTitle" style="margin-top: 0.3rem;">修改会员等级</p>
		<input type="number" name="level" placeholder="请输入修改等级" class="jhmInput" />
        <input type="hidden" name="mid" value="{{ list.keyid }}">
		<div class="sureBtn">确认</div>
	</div>
</body>
<script type="text/javascript">
	$(function() {
		$('.login_btn').click(function() {
			$('.mask').show();
			$('.jhmBox').show();
		});
        $('.close').click(function() {
            $('.mask').hide();
            $('.jhmBox').hide();
        });
		
		$('.sureBtn').click(function() {
            var level=$("input[name='level']").val();
            var mid=$("input[name='mid']").val();
            if(level == ''){
                layer.open({
                    content: '请输入修改等级'
                    ,skin: 'msg'
                    ,time: 2 //2秒后自动关闭
                });
                
                return false;
            }
            if((level < 0) || (level > 9)){
                layer.open({
                    content: '会员等级为0~9级'
                    ,skin: 'msg'
                    ,time: 2 //2秒后自动关闭
                });
                
                return false;
            }
            $.ajax({
                type : "POST",
                url:"/edit_level/",//+tab,
                headers:{"X-CSRFToken":$.cookie('csrftoken')},
                data:{'mid':mid,'level':level}, 
                dataType:'json',		
                success: function(data){
                   if(data.code == 1){
                        $('.mask').hide();
                        $('.jhmBox').hide();
                        
                        layer.open({
                            content: data.msg
                            ,skin: 'msg'
                            ,time: 3 //2秒后自动关闭
                        });
                        setTimeout(function(){
                            window.location.reload()
                        },700);
                    }else{
                        layer.open({
                            content: data.msg
                            ,skin: 'msg'
                            ,time: 2 //2秒后自动关闭
                        });
                    }	
                }
            });
		})
	})
</script>
</html>